<?php
echo "ok here???>>";
include 'include/functions.php';
echo "ok here???>>";
//Connect To Database
dbConnect();
//Write SQL Query to extract specified data
$SQL = "Select ID, Password From Users";
$result = mysql_query($SQL) or die("Cannot query the database.<br/>");
do{
	$SQL = "UPDATE Users SET Password='".sha1($myrow["Password"])."' WHERE ID=".$myrow["ID"];
	mysql_query($SQL) or die("Cannot query the database to update stuff.<br/>");
}while($myrow = mysql_fetch_array($result));

echo "pwd update complete";
break;

//check to make sure $Weeknum > 1 AND $Weeknum < 21
$Weeknum = checkWeekBounds(getWeek("NHL"));
//Write SQL Query to extract specified data
$SQL = "Select ID, NHL From Users WHERE (Username='".$uname."') AND (Password='".sha1($passwd)."') AND (flag = 1)";
//Open Record Set using SQL Query
$result = mysql_query($SQL) or die("Cannot query the database to look up user.<br/>");
$num_rows = mysql_num_rows($result);
$myrow = mysql_fetch_array($result);
if ($num_rows == 1)
{
	//set session save path
	session_save_path($session_path);
	//session_save_path('sessions');
	// Initialize a session. 
	session_start();
						 
	// If this is a new session ...
	if (!session_is_registered("count")) 
	{
	 session_register("count", "start", "userID", "username","PlayNHL");                         
	 $count = 0;
	 $start = time();
	 $userID = $myrow["ID"];
	 $username = $uname;
	 //$MadePlayoffs = $myrow["PlayOffs"];
	 $PlayNHL = $myrow["NHL"];
	} 
	else $count++;
	$sessionId = session_id();   
	
	
	echo "path=$session_path";
	//break;
	?>
	<SCRIPT language="JavaScript">
		<!--
		location.replace("menu.php");
		//-->
	</SCRIPT>
	<?         

}
else {
  echo "There was an error with your username or password, OR you can't log in at this time because you did not make the playoffs.<br/><a href=\"http://football.joshhughes.com/menu.php\">Please Go Back</a> and try again.";
}
?>
